package tech.aistar.wyymusicplayer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.aistar.wyymusicplayer.pojo.Result;
import tech.aistar.wyymusicplayer.pojo.Search;
import tech.aistar.wyymusicplayer.service.SearchService;

import java.util.List;

@RestController // = @ResponseBody + @Controller
@RequestMapping("search")
public class SearchController {
    @Autowired
    private SearchService searchService;

    @GetMapping
    public Result searchSongs(String text){
       List<Search> searchList = searchService.searchsongs(text);
        return new Result("200","查找成功",searchList);
    }
}
